package com.goktech.controller;

import com.goktech.pojo.Commodity;
import com.goktech.service.CommodityService;
import com.goktech.utils.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 商品表 前端控制器
 * </p>
 *
 * @author 初茶
 * @since 2023-05-14
 */
@RestController
@RequestMapping("/commodity")
public class CommodityController {
    @Resource
    private CommodityService commodityService;

    @RequestMapping("/succulentList")
    public Result<List<Commodity>> succulentList() {
        return commodityService.succulentList();
    }

    @RequestMapping("/artificialList")
    public Result<List<Commodity>> artificialList() {
        return commodityService.artificialList();
    }

    @GetMapping("/goodsDetail/{id}")
    public Result<Commodity> goodsDetail(@PathVariable Integer id) {
        return commodityService.goodsDetail(id);
    }
}

